<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>title</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css"/>
    <style>
        .mike-txt-title {
            background: linear-gradient(to right, red, blue);
            -webkit-background-clip: text;
            color: transparent;
        }
        .myui-jifen-box8 {
            padding: 8px;
        }
    </style>
</head>
<body>


<header class="aui-navBar aui-navBar-fixed"  id="aui-header">
    <a tapmode onclick="closeWin()" class="aui-navBar-item">
        <i class="icon icon-back"></i>
    </a>
    <div class="aui-center">
        <span class="aui-center-title mike-txt-title" id="title" >搜索结果</span>
    </div>
    <a class="aui-navBar-item" style="color: #725f5f;">
        <i class="icon"></i>
    </a>
</header>
<div class="myui-jifen-box8">
    <div id="search_a">搜索中..请稍等...</div>
</div>

</body>
<script type="text/x-dot-template" id="search_b">
    {{~ it.data : value : index }}
    <div style="background-color: #f5f5f5a1;border-radius: 13px">
        <table style="width: 100%" cellpadding="10" cellspacing="0">
            <tr>
                <td rowspan="2" style="width: 30%;height: 50%"><img src={{=value.vod_pic}}></td>
                <td><span>{{=value.vod_name}}</span></td>
            </tr>
            <tr>
                <td>
                    <button onclick="toBanner('{{=value.vod_id}}')" style="background-color: #0b97c4;border-radius: 10px;font-size: 17px">立即播放
                    </button>
                </td>
            </tr>
        </table>
    </div>
    <br>
    {{~}}
</script>

</body>
<script type="text/javascript" src="../script/api.js" ></script>
<script type="text/javascript" src="../script/doT.js"></script>
<script type="text/javascript">
    apiready = function(){
        api.parseTapmode();
        var header = $api.byId('aui-header');
        $api.fixStatusBar(header);
        var headerPos = $api.offset(header);
        var body_h = $api.offset($api.dom('body')).h;
        var search_a = $api.byId('search_a');//位置
        var search_b = $api.byId("search_b");//模板
        var name = api.pageParam.name;//关键词
        var api_url = localStorage.getItem('api_url');
        api.ajax({
            url: api_url + '/login/login/searchdata.html',
            method: 'get',
            data: {
                values: {
                    name:name
                }
            }
        }, function (ret, err) {
            if (ret) {
                //渲染模板
                var pagefn = doT.template(search_b.text);
                // search_a.html(pagefn(ret));
                search_a.innerHTML = pagefn(ret);
            } else {
                api.toast({
                    msg: '加载中...',
                    duration: 2000
                });
                search_a.innerHTML ="抱歉，未搜索到内容，请联系客服反馈~";
            }
        });
    }

    function toBanner(vod_id) {
        // api.openWin({
        //     name: 'searchplay',
        //     url: './searchplay.html',
        //     pageParam: {
        //         vod_id:vod_id
        //     }
        // });
        api.openWin({
            name: 'search_play',
            url: './search_play.html',
            pageParam:{id:vod_id}
        });
    }

    function closeWin(){
        var browser = api.require('webBrowser');
        browser.historyBack(
            function(ret, err) {
                if (!ret.status) {
                    api.closeWin();
                }
            }
        );
    }
    function closeWd(){
        api.closeWin();
    }
</script>
</html>
